package com.example.springbootredisdemo.listener;

import com.alibaba.fastjson.JSONObject;
import com.example.springbootredisdemo.dto.UserDTO;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

/**
 * @author sharloon
 * @date 2023/6/26
 */
@Component
public class Listener2 implements MessageListener {

    @Override
    public void onMessage(Message message, byte[] pattern) {
        UserDTO userDTO = JSONObject.parseObject(message.toString(), UserDTO.class);
        System.err.println("listener2--->" + userDTO);
    }
}
